<?php
class Training_SessionController extends Zendvn_Controller_Action{
	
	protected $_ns;
	public function init(){
		echo '<br>' . __METHOD__;
		$this->_ns = new Zend_Session_Namespace('time');
		$this->_ns->lock();
	}
	
	public function index9Action(){
		$tmp = new Zend_Session_Namespace('abc');
		$tmp->test = 'Test';
		echo '<pre>';
		print_r($tmp->getIterator());
		echo '</pre>';
		
		$this->_helper->viewRenderer->setNoRender();
	}
	
	public function index8aAction(){
		if($this->_ns->isLocked()){
			$this->_ns->unlock();
			$this->_ns->str4 = 'This is a test 4';
		}
		
		echo '<pre>';
		print_r($this->_ns->getIterator());
		echo '</pre>';
		
		$this->_helper->viewRenderer->setNoRender();
	}
	
	public function index8Action(){
		echo '<br>' . __METHOD__;
		$ns = new Zend_Session_Namespace('time');
		$ns->str = 'This is a test';
		$ns->no = 12345;
	
		echo '<pre>';
		print_r($ns->getIterator());
		echo '</pre>';
		
		$ns->str2 = 'This is a test 2';
		
		echo '<pre>';
		print_r($ns->getIterator());
		echo '</pre>';
		
		$ns->lock();
		//$ns->str3 = 'This is a test 3';
		
		echo '<pre>';
		print_r($ns->getIterator());
		echo '</pre>';
		
		$this->_helper->viewRenderer->setNoRender();
	}
	
	
	public function index7Action(){
		echo '<br>' . __METHOD__;
		$ns = new Zend_Session_Namespace('time');
		$ns->str = 'This is a test';
		$ns->no = 12345;
	
		echo '<pre>';
		print_r($ns->getIterator());
		echo '</pre>';
		
		echo '<br>' . $ns->apply('count');
		
		$this->_helper->viewRenderer->setNoRender();
	}
	
	public function index6Action(){
		echo '<br>' . __METHOD__;
		$ns = new Zend_Session_Namespace('time');
		
		echo '<pre>';
		print_r($ns->getIterator());
		echo '</pre>';
		
		//unset($ns->no);
		$ns->unsetAll();
		
		echo '<pre>';
		print_r($ns->getIterator());
		echo '</pre>';
		
		$this->_helper->viewRenderer->setNoRender();
	}
	
	public function index5Action(){
		echo '<br>' . __METHOD__;
		$ns = new Zend_Session_Namespace('time');
		$ns->str = 'This is a test';
		$ns->no = 12345;
	
		echo '<pre>';
		print_r($ns->getIterator());
		echo '</pre>';
		
		$this->_helper->viewRenderer->setNoRender();
	}
	
	public function index4Action(){
		echo '<br>' . __METHOD__;
		$ns = new Zend_Session_Namespace('time');
		echo '<br>' . $ns->str;
		echo '<br>' . $ns->no;
		
		echo '<pre>';
		print_r($ns->getIterator());
		echo '</pre>';
		
		$this->_helper->viewRenderer->setNoRender();
	}
	
	public function index3Action(){
		echo '<br>' . __METHOD__;
		$ns = new Zend_Session_Namespace('time');
		$ns->str = 'This is a test';
		$ns->no = 12345;
		$ns->setExpirationSeconds(10);
		
		
		echo '<pre>';
		print_r($ns->getIterator());
		echo '</pre>';
		
		$this->_helper->viewRenderer->setNoRender();
	}
	
	public function index2Action(){
		
		$ns = new Zend_Session_Namespace('tmp');
		
		echo '<br>' . $ns->str;
		echo '<br>' . $ns->no;
		echo '<br>' . $ns->arr;
		
		$ns1 = new Zend_Session_Namespace('tmp1');
		echo '<pre>';
		print_r($ns1->getIterator());
		echo '</pre>';
		$this->_helper->viewRenderer->setNoRender();
	}
	
	
	public function indexAction(){
		echo '<br>' . __METHOD__;
		$ns = new Zend_Session_Namespace('tmp');
		$ns->str = 'This is a test';
		$ns->no = 12345;
		$ns->arr = array(1,2,4,5,6);
		$conn = Zend_Registry::get('dbConnect');
		
		$ns->obj = $conn; 
		
		echo '<pre>';
		print_r($ns->getIterator());
		echo '</pre>';
		
		$this->_helper->viewRenderer->setNoRender();
	}
	
	
}